package com.sykj.why.mongo.document.entity;

import com.sykj.why.mongo.enums.SolrEnum;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.apache.solr.client.solrj.beans.Field;

import java.io.Serializable;

/**
 * @author Eleven
 * @date 2019/6/18
 * @desc 存放Solr服务器的公用对象
 */

@Setter
@Getter
@ToString
public class SolrDocumentT implements Serializable {

    /**
     * id
     */
    @Field("id")
    private Object id;
    /**
     * 类型  {@link com.sykj.why.mongo.enums.SolrEnum}
     */
    @Field("type")
    private Object type;
    @Field("typeName")
    private Object typeName;
    /**
     * 标题
     */
    @Field("title_txt")
    private Object title;
    /**
     * 封面
     */
    @Field("cover")
    private Object cover;
    /**
     * 简介
     */
    @Field("summary")
    private Object summary;
    /**
     * 地址链接
     */
    @Field("source_url")
    private Object source_url;

    /**
     * 资源分类
     */
    @Field("source_category")
    private Object source_category;
    @Field("categoryName")
    private Object categoryName;

    @Field("enable")
    private Object enable;

    public SolrDocumentT(Object id, Object type, Object typeName, Object title, Object cover, Object summary, Object source_url, Object source_category, Object categoryName, Object enable) {
        this.id = id;
        this.type = type;
        this.typeName = typeName;
        this.title = title;
        this.cover = cover;
        this.summary = summary;
        this.source_url = source_url;
        this.source_category = source_category;
        this.categoryName = categoryName;
        this.enable = enable;
    }

    /**
     * 构造方法
     *
     * @param id         资源id
     * @param type       资源类型
     * @param title      资源名称、标题
     * @param cover      资源封面
     * @param summary    资源简介
     * @param source_url 资源原文链接
     * @param source_category 资源分类
     * @param categoryName 分类名称
     */
    public SolrDocumentT(Object id, Object type, Object title, Object cover, Object summary, Object source_url, Object source_category, Object categoryName, Object enable) {
        this.id = id;
        this.type = type;
        this.typeName = SolrEnum.Document.getName((Integer) type);
        this.title = title;
        this.cover = cover;
        this.summary = summary;
        this.source_url = source_url;
        this.source_category = source_category;
        this.categoryName = categoryName;
        this.enable = enable;
    }

    public SolrDocumentT() {
    }

}
